# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: spider-mario <spidermario@free.fr>
# Contributor: Daniel Ehlers <danielehlers@mindeye.net>

pkgname=coin-or-mp
pkgver=1.8.4
pkgrel=5
pkgdesc='C-API library that supports most of the functionality of CLP (Coin LP), CBC (Coin Branch-and-Cut), and CGL (Cut Generation Library) projects'
arch=(loong64 x86_64)
url='https://projects.coin-or.org/CoinMP'
license=(EPL)
groups=(coin-or)
depends=(coin-or-cbc)
source=(https://www.coin-or.org/download/source/CoinMP/CoinMP-$pkgver.tgz)
sha256sums=('3459fb0ccbdd39342744684338984ac4cc153fb0434f4cae8cf74bd67490a38d')

build() {
  cd CoinMP-$pkgver
  COIN_SKIP_PROJECTS="Sample" \
  ./configure --prefix=/usr \
              --with-osi-lib="$(pkg-config --libs osi)" \
              --with-osi-incdir="/usr/include/coin/" \
              --with-clp-lib="$(pkg-config --libs clp)" \
              --with-clp-incdir="/usr/include/coin/" \
              --with-cgl-lib="$(pkg-config --libs cgl)" \
              --with-cgl-incdir="/usr/include/coin/" \
              --with-cbc-lib="$(pkg-config --libs cbc)" \
              --with-cbc-incdir="/usr/include/coin/" \
              --with-coinutils-lib="$(pkg-config --libs coinutils)" \
              --with-coinutils-incdir="/usr/include/coin/"
  make
}

check() {
  cd CoinMP-$pkgver
  make test
}

package() {
  cd CoinMP-$pkgver/CoinMP

  make DESTDIR="$pkgdir" install
  rm -r "$pkgdir"/build
}
